﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chap05Demo
{
    public class SwordDamage
    {
        /// <summary>
        /// 基础伤害
        /// </summary>
        public const int BASE_DAMAGE = 3;

        /// <summary>
        /// 火焰伤害
        /// </summary>
        public const int FLAME_DAMAGE = 2;

        public int Roll;

        /// <summary>
        /// 魔法伤害系数
        /// </summary>
        public decimal MagicMultiplier = 1M;

        public int FlamingDamage = 0;

        public int Damage;

        public void CalulateDamage()
        {
            Damage = (int)(Roll * MagicMultiplier) + BASE_DAMAGE + FlamingDamage;
        }

        public void SetMagic(bool isMagic)
        {
            if (isMagic)
            {
                MagicMultiplier = 1.75M;
            }
            else
            {
                MagicMultiplier = 1M;
            }
            CalulateDamage();
        }

        public void SetFlaming(bool isFlaming)
        {
            CalulateDamage();
            if (isFlaming)
            {
                Damage += FLAME_DAMAGE;
            }
        }
    }
}
